package com.why.basictype;

import com.why.utils.BaseConversionUtils;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author by xiaoTian
 * @date 2022/5/20.
 */
public class U4 {

    int value;

    public U4(int value){
        this.value = value;
    }

    public static U4 read(InputStream inputStream){
        byte[] bytes = new byte[4];
        try {
            inputStream.read(bytes);
        } catch (IOException e) {
            e.printStackTrace();
        }
        int value = BaseConversionUtils.byte2int(bytes);
        U4 U4 = new U4(value);
        return U4;
    }
    public int getValue(){return this.value;}

    public String getHexValue(){
        return Integer.toHexString(value);
    }

}
